/*
 * HTMLDocument.h
 *
 *  Created on: 2010-6-10
 *      Author: guobc
 */

#ifndef HTMLDOCUMENT_H_
#define HTMLDOCUMENT_H_

#include <memory>
#include "ASTDom.h"
#include "HTMLParser.h"
#include "HTMLLexer.h"

namespace HA {

class HTMLDocument: public HA::ASTDom {
public:
	HTMLDocument();

	/**
	 * Open this document.
	 * @return True if success open, false otherwise.
	 */
	bool open(const string& htmlName);

	/**
	 * Close this document.
	 */
	void close();

	/**
	 * parse the content of this document.
	 */
	void parse() throw (exception);

	//	/**
	//	 * Set the root AST node to ASTDom.
	//	 * @param root The root AST node.
	//	 */
	//	inline void setRootNode(ASTNode* root) {
	//		mRoot = root;
	//	}

	/**
	 * Get the root AST node to ASTDom.
	 * @param root The root AST node.
	 */
	inline Element* getRootNode() {
		return mRoot;
	}

private:
	Element* mRoot;
};

}

#endif /* HTMLDOCUMENT_H_ */
